From: Florian Müllner Date: Fri, 30 Aug 2013 18:25:19 +0000 (+0200) Subject: appDisplay: Default to All view when not enough usage data is available X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3531 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=938628a05f5df838351e538ae53894ed76ec516d;p=gnome-shell.git appDisplay: Default to All view when not enough usage data is available The frequent view is not useful when it doesn't contain any applications yet. While the previously added label makes this state appear less like an error (OMG, my apps are gone!), it doesn't address the issue of usefulness - default to the more helpful All view in this case. https://bugzilla.gnome.org/show_bug.cgi?id=694710 --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index e19ad13a7..c1e44dc47 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -591,9 +591,13 @@ const FrequentView = new Lang.Class({ this._usage = Shell.AppUsage.get_default(); }, + hasUsefulData: function() { + return this._usage.get_most_used("").length >= MIN_FREQUENT_APPS_COUNT; + }, + loadApps: function() { let mostUsed = this._usage.get_most_used (""); - let hasUsefulData = mostUsed.length >= MIN_FREQUENT_APPS_COUNT; + let hasUsefulData = this.hasUsefulData(); this._noFrequentAppsLabel.visible = !hasUsefulData; if(!hasUsefulData) return; @@ -724,7 +728,8 @@ const AppDisplay = new Lang.Class({ this._showView(viewIndex); })); } - this._showView(Views.FREQUENT); + let frequentUseful = this._views[Views.FREQUENT].view.hasUsefulData(); + this._showView(frequentUseful ? Views.FREQUENT : Views.ALL); this._updateFrequentVisibility(); // We need a dummy actor to catch the keyboard focus if the